/*
 * @Author: atdow
 * @Date: 2021-07-14 20:24:03
 * @LastEditors: null
 * @LastEditTime: 2021-07-21 10:38:29
 * @Description: file description
 */

import request from "@/utils/request";

// 服务记录
export function getThrottlingList(params = {}) {
    return request({
        url: `/system/apiMonitor/getLimitingList`,
        method: "get",
        params
    });
}

/**
 * 服务监控-限流列表-弹窗
 * @param { integer } limitingId
 * @returns
 */
export function getApiList(params = {}) {
    return request({
        url: `/system/apiMonitor/getLimitingApiList`,
        method: "get",
        params
    });
}

/**
 * 获取已发布api
 * @param {*} params
 * @returns
 */
export function getApiTree(params = {}) {
    return request({
        url: `/system/apiMonitor/getApiList`,
        method: "get",
        params
    });
}

/**
 * 限制的接口列表
 * @param { array } selected
 * @returns
 */
export function getLimitApiList(data = {}, params) {
    return request({
        url: `/system/apiMonitor/getApiLimitingList`,
        method: "post",
        data: data,
        params: params
    });
}

/**
 * 限流状态修改
 * @param { array } limitingIds
 * @param { integer(int32) } status 修改状态(0禁用，1启用)
 * @returns
 */
export function editLimitingStatus(data = {}) {
    return request({
        url: `/system/apiMonitor/editLimitingStatus`,
        method: "post",
        data: data
    });
}

/**
 * 限流规则添加和编辑
 * @param { array } selected
 * @returns
 */
export function editLimitingRule(params = {}) {
    return request({
        url: `/system/apiMonitor/editLimiting`,
        method: "post",
        data: params
    });
}

/**
 * 获取修改限流规则信息
 * @param { integer } limitingId
 * @returns
 */
export function getEditLimitingRule(params = {}) {
    return request({
        url: `system/apiMonitor/getLimitingApiList`,
        method: "get",
        params: params
    });
}
